package jw.hospital.cmn.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jw.hospital.cmn.service.DictService;
import jw.hospital.common.result.ResultResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;


@Api(tags= "数据字典")
@RestController
@RequestMapping(value ="/admin/cmn/dict")
public class DictController {
    @Autowired
    private DictService dictService;

    @ApiOperation(value = "导入字典")
    @PostMapping(value="importData")
    public ResultResponse  importData(MultipartFile file){
      dictService.importData(file);
      return  ResultResponse.ok();
    }

    @ApiOperation(value = "导出用户字典")
    @GetMapping(value = "exportDictData")
    public  ResultResponse  exportDictData(HttpServletResponse response) {
      dictService.exportDictData(response);
      return   ResultResponse.ok();
    }





}
